<?php $this -> load -> view('adminx/header'); ?>
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
	<?php $this -> load -> view('adminx/mune'); ?>
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- /.modal -->
			<h3 class="page-title"> <?php echo $title; ?> <small><?php echo $en; ?></small></h3>
			<div class="page-bar">
				<ul class="page-breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="/adminx">首页</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="#"><?php echo $title; ?></a>
					</li>
				</ul>
			</div>
			<!-- END PAGE HEADER-->
			<div class="clearfix"></div>
			<div class="row">
				<div class="col-md-12 col-sm-12">
					<!-- BEGIN REGIONAL STATS PORTLET-->
					<div class="note note-success">
						<p>1，微信二维码信息的单位为像素；</p>
						<p>2，姓名将使用居中算法，由于每个名字的长度不一所以不提供距离左边的参数设置；</p>
						<p>3，底图尺寸：483 × 800；</p>
					</div>
				 </div>
		    </div>
			<div class="row">
				<div class="col-md-6 col-sm-6">
					<div class="portlet light">
						<div class="portlet-title tabbable-line">
							<div class="caption">
								<i class="icon-umbrella font-red-sunglo"></i>
								<span class="caption-subject font-red-sunglo bold uppercase">会员二维码信息</span>
							</div>
						</div>
						<div class="portlet-body">
							<form method="post" id="qr_up" name="qr_up">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="name_top" value="<?php echo $qr['name_top']; ?>">
									<label for="form_control_1">姓名上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_k" value="<?php echo $qr['tx_k']; ?>">
									<label for="form_control_1">头像宽度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_g" value="<?php echo $qr['tx_g']; ?>">
									<label for="form_control_1">头像高度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_top" value="<?php echo $qr['tx_top']; ?>">
									<label for="form_control_1">头像上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_left" value="<?php echo $qr['tx_left']; ?>">
									<label for="form_control_1">头像左边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_k" value="<?php echo $qr['qr_k']; ?>">
									<label for="form_control_1">微信二维码宽度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_g" value="<?php echo $qr['qr_g']; ?>">
									<label for="form_control_1">微信二维码高度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_top" value="<?php echo $qr['qr_top']; ?>">
									<label for="form_control_1">微信二维码上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_left" value="<?php echo $qr['qr_left']; ?>">
									<label for="form_control_1">微信二维码左边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								<div class="form-group form-md-line-input form-md-floating-label">
								<label>二维码底图 （尺寸：483 × 800）</label>
								<?php echo $this -> form -> doform('pic', 'qr_bg', '',$qr['qr_bg']); ?>
							     </div>
								<button data-dismiss="modal" type="reset" class="btn default">
					                 <i class="fa fa-refresh"></i>
					               重置
				                </button>
								<button data-dismiss="modal" type="submit" class="btn default blue">
					                 <i class="fa fa-send"></i>
					               设置
				                </button>
							</form>
						</div>
					</div>
				</div>
				<div class="col-md-6 col-sm-6">
					<div class="portlet light">
						<div class="portlet-title tabbable-line">
							<div class="caption">
								<i class="icon-cursor font-green-sharp"></i>
								<span class="caption-subject font-green-sharp bold uppercase">会员二维码预览</span>
							</div>
						</div>
						<div class="portlet-body" id="qr_yl">
							<div class="form-group form-md-line-input has-warning form-md-floating-label">
							      <div class="input-group">
											<span class="input-group-btn btn-left">
											<button onclick="qr_yl()" class="btn blue-madison" type="button">预览</button>
											</span>
											<div class="input-group-control">
												<input type="text" class="form-control" id="qr_mid">
												<label for="form_control_1">会员MID</label>
											</div>
									</div>
							</div>
							<p>
								<img style="display: none;" id="qr_img" class="img-responsive center-block" src="" />
							</p>
							<br /><br /><br />
						</div>
					</div>
				</div>
			</div>
			<div class="clearfix"></div>
			
			
			<?php if($this->config->item('plug_co')){ ?>
			<div class="row">
				<div class="col-md-6 col-sm-6">
					<div class="portlet light">
						<div class="portlet-title tabbable-line">
							<div class="caption">
								<i class="icon-umbrella font-red-sunglo"></i>
								<span class="caption-subject font-red-sunglo bold uppercase">万人群二维码信息</span>
							</div>
						</div>
						<div class="portlet-body">
							<form method="post" id="qr_qun_up" name="qr_qun_up">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="name_top" value="<?php echo $qr_qun['name_top']; ?>">
									<label for="form_control_1">姓名上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_k" value="<?php echo $qr_qun['tx_k']; ?>">
									<label for="form_control_1">头像宽度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_g" value="<?php echo $qr_qun['tx_g']; ?>">
									<label for="form_control_1">头像高度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_top" value="<?php echo $qr_qun['tx_top']; ?>">
									<label for="form_control_1">头像上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="tx_left" value="<?php echo $qr_qun['tx_left']; ?>">
									<label for="form_control_1">头像左边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_k" value="<?php echo $qr_qun['qr_k']; ?>">
									<label for="form_control_1">微信二维码宽度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_g" value="<?php echo $qr_qun['qr_g']; ?>">
									<label for="form_control_1">微信二维码高度</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								
								<div class="row">
									<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_top" value="<?php echo $qr_qun['qr_top']; ?>">
									<label for="form_control_1">微信二维码上边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								<div class="col-md-6">
								<div class="form-group form-md-line-input">
									<input type="text" class="form-control number required" name="qr_left" value="<?php echo $qr_qun['qr_left']; ?>">
									<label for="form_control_1">微信二维码左边距距离</label>
									<span class="help-block">填写数字，单位为像素</span>
								</div>
								</div>
								</div>
								<div class="form-group form-md-line-input form-md-floating-label">
								<label>二维码底图 （尺寸：483 × 800）</label>
								<?php echo $this -> form -> doform('pic', 'qr_bg', '',$qr_qun['qr_bg']); ?>
							     </div>
								<button data-dismiss="modal" type="reset" class="btn default">
					                 <i class="fa fa-refresh"></i>
					               重置
				                </button>
								<button data-dismiss="modal" type="submit" class="btn default blue">
					                 <i class="fa fa-send"></i>
					               设置
				                </button>
							</form>
						</div>
					</div>
				</div>
				<div class="col-md-6 col-sm-6">
					<div class="portlet light">
						<div class="portlet-title tabbable-line">
							<div class="caption">
								<i class="icon-cursor font-green-sharp"></i>
								<span class="caption-subject font-green-sharp bold uppercase">万人群二维码预览</span>
							</div>
						</div>
						<div class="portlet-body" id="qr_qun_yl">
							<div class="form-group form-md-line-input has-warning form-md-floating-label">
							      <div class="input-group">
											<span class="input-group-btn btn-left">
											<button onclick="qr_qun_yl()" class="btn blue-madison" type="button">预览</button>
											</span>
											<div class="input-group-control">
												<input type="text" class="form-control" id="qr_qun_mid">
												<label for="form_control_1">会员MID</label>
											</div>
									</div>
							</div>
							<p>
								<img style="display: none;" id="qr_qun_img" class="img-responsive center-block" src="" />
							</p>
							<br /><br /><br />
						</div>
					</div>
				</div>
			</div>
	       <?php }?>		
			<div class="clearfix"></div>
			<div class="row">
			  <div class="col-md-6 col-sm-6">
				<div class="portlet light">
						<div class="portlet-title tabbable-line">
							<div class="caption">
								<i class="icon-graph font-blue-sharp"></i>
								<span class="caption-subject font-blue-sharp bold uppercase">全部更新二维码</span>
							</div>
						</div>
						<div class="portlet-body">
							<div class="alert alert-success" role="alert">
								生成二维码的进程将进入后端运行
							</div>
							<div class="alert alert-warning" role="alert">
								会员量比较大时，更新全部二维码缓冲比较消费服务器资源，请不要频繁操作
							</div>
							<button id="re_all" onclick="re_all()" type="button" class="btn purple btn-block" >  <i class="fa fa-send"></i> 执行全部更新二维码</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- END CONTENT -->
	<!-- BEGIN QUICK SIDEBAR -->
	<?php $this -> load -> view('adminx/lt'); ?>
	<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<?php $this -> load -> view('adminx/footer'); ?>
<script src="/mex/global/plugins/ajaxfileupload.js"></script>
<script>
     $(function(){
		up_form($("#qr_up"), "/iadmin/qrcode/up", "修改二维码配置", function(msg) {
			if (msg.type == 1) {
				alert_ts('修改会员二维码配置成功.');
			} else {
				alert_ts('修改会员二维码配置失败.');
			}
		});
		
		up_form($("#qr_qun_up"), "/iadmin/qrcode/qun_up", "修改二维码配置", function(msg) {
			if (msg.type == 1) {
				alert_ts('修改万人群二维码配置成功.');
			} else {
				alert_ts('修改万人群二维码配置失败.');
			}
		});
	}); 
</script>